package org.flown.shop.controller;


import org.flown.shop.entity.Orders;
import org.flown.shop.service.OrdersService;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


@RequestMapping("/orders")
@Controller
public class OrdersController
{
    private final OrdersService service_orders;

    public OrdersController(OrdersService service_orders)
    {
        this.service_orders = service_orders;
    }


    @ResponseBody
    @RequestMapping(value = "/getOrdersByID", produces = MediaType.APPLICATION_JSON_VALUE)
    public Orders getOrdersByID(@RequestParam("id") int id)
    {
        return this.service_orders.getOrdersByID(id);
    }

    public void updateOrdersByID(Orders orders) {this.service_orders.updateOrdersByID(orders);}
    public void deleteOrdersByID(int id) {this.service_orders.deleteOrdersByID(id);}


    /**
     * goodsID
     * userID
     * sellerID
     * storeID
     * count 默认1
     * address
     * price
     * */
    public void insertOrders(Orders orders)
    {
        this.service_orders.insertOrders(orders);
    }



}











